<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="include/head::commonHeaderCustomEdit('学员学习报表',~{::style})">
    <style>

    </style>
</head>
<body>
<div class="ch-container">
    <div class="box-left">
        <form th:action="@{/student/report/create}" method="post" class="form-inline" onsubmit="return checkForm()">
            <input th:type="hidden" th:name="personId" th:value="${personId}">
            <input th:type="hidden" th:name="tokenString" th:value="${tokenString}">
            <div style="text-align: center;">
                <span>开始日期：<input name="startDate" id="startDate" class="form-control input-sm" readonly autocomplete="off" maxlength="20" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd 08:00:00',maxDate:'#F{$dp.$D(\'endDate\')||\'%y-%M-%d\'}',minDate:'2015-05-15'})" th:value="${startDate}"> </span>
                <span style="margin-left: 50px;">结束日期：<input name="endDate" id="endDate" class="form-control input-sm" readonly autocomplete="off" maxlength="20" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd 23:00:00',minDate:'#F{$dp.$D(\'startDate\')}',maxDate:'%y-%M-%d'})" th:value="${endDate}"></span>
                <button class="btn btn-primary btn-sm" th:text="生成学习报表" th:type="submit"></button>
                <button class="btn btn-success btn-sm" th:text="添加阶段检测反馈" th:type="button" th:onclick="|createFeedback()|"></button>
                <span style="color: red;font-weight: bold;" th:if="${status==0}" th:text="${errMsg}"></span>
            </div>
        </form>
    </div>
    <div class="box-right">
        <iframe src="http://testm.etalk365.com/mcrm/#/daily?appbarHidden=1" th:src="@{${webUrl}+'/mcrm/#/daily?appbarHidden=1&tokenString='+${tokenString}}" frameborder="no" scrolling="auto" style="border: none;width:100%;display: block;height:100%;"></iframe>
    </div>
</div>
<div th:include="include/onload_js::onloadJSCustom(~{::script})">
    <script src="../../static/My97DatePicker/WdatePicker.js" th:src="@{/static/My97DatePicker/WdatePicker.js}"></script>
    <script>
        $(function () {
            document.querySelector('iframe').style.height = window.innerHeight + 30 + 'px'
        });
        $(window).resize(function() {
            document.querySelector('iframe').style.height = window.innerHeight + 30 + 'px'
        });

        function checkForm() {
            let startDate=$("#startDate").val();
            let endDate=$("#endDate").val();
            if ($.trim(startDate)===""){
                layer.msg("请选择开始日期",{icon:2});
                return false;
            }
            if ($.trim(endDate)===""){
                layer.msg("请选择结束日期",{icon:2});
                return false;
            }
        }
        function createFeedback() {
            let url='/student/report/init/check/feedback/[[${personId}]]';
            layer.open({
                type: 2,
                title: false,
                closeBtn: 1, //显示关闭按钮
                shade: [0.1],
                area: ['85%', '98%'],
                //offset: 'rb', //右下角弹出
                // time: 2000, //2秒后自动关闭
                minWidth: '800px',
                anim: 2,
                content: [url, 'auto'], //iframe的url，no代表不显示滚动条
                end: function () {
                    //location.reload(true);
                }
            });
        }
    </script>
</div>
</body>
</html>